

 <script type="text/javascript">
 RED.nodes.registerType('wechat in',{ 
	category: 'wechat',
	color: '#00CC00', 
	defaults: { name: {value:""},
				token:{value:""},
				encoding:{value:"0"},
				// key:{value:"",validate:function(v){return v.length==43}},
				key:{value:""},
				path:{value:""}
				},
	align:"left",
	inputs:0, outputs:1, icon: "weChatImage.jpeg", 
	label: function() { return this.name||"wechat"; },
	oneditprepare: function(){
		// alert($('#node-input-key').val());
		encoding = $('#node-input-encoding').val();
		$('#node-input-encoding').change(function(){
			encoding = $('#node-input-encoding').val();
			switch(encoding){
				case "0":
				  $('#node-div-key').hide();
				  // var phantom="";
				  // for(var x = 0;x<43;x++){
				  // 	phantom +="a";
				  // }
				  //$('#node-input-key').val(phantom);
				break;
				case "1":
					$('#node-div-key').show();
					//$('#node-input-key').val("");
				break;
			}
		});

		
			$('#node-input-path').change(function(){
			var path = $('#node-input-path').val();

			$('#node-p-path').html('The url will be http://{hostname}'+path);
                
		})
	}

	 });
	
 	

	</script>



<script type="text/x-red" data-template-name="wechat in"> 


<div class="form-row"> 
<label for="node-input-name">
<i class="icon-tag"></i> name
</label> 
	<input type="text" id="node-input-name" placeholder="Name">
	</div> 

<div class="form-row"> 
<label for="node-input-path">
<i class="fa fa-plane"></i> path
</label> 
	<input type="text" id="node-input-path" placeholder="/path">

	<p id="node-p-path"></p>
</div> 


<div class="form-row" id="node-div-token"> 
<label for="node-input-token">
<i class="fa fa-ticket"></i> token
</label> 
	<input type="text" id="node-input-token" placeholder="token">
	</div> 


<div class="form-row"> 
<label for="node-input-encoding">
<i class="fa fa-lock"></i> security
</label> 
	<select type="text" id="node-input-encoding" name="node-input-encoding">
		<option value="0">no encryption</option>
		<option value="1">encryption</option>
	</select>
	</div> 

<div class="form-row" id='node-div-key'> 
<label for="node-input-key">
<i class="fa fa-key"></i> AESKey Encoding
</label> 
	<input type="text" id="node-input-key" placeholder="key">
	</div> 



	</script>


<script type="text/x-red" data-help-name="wechat in">
 <p>ETI wechat makes a difference !
 </p> 

 </script>



 <script type="text/javascript">

 RED.nodes.registerType('wechat out',{ 
	category: 'wechat',
	color: '#00CC00', 
	defaults: { name: {value:""}
				},
	align:"right",
	inputs:1, outputs:0, icon: "weChatImage.jpeg", 
	label: function() { return this.name||"wechat"; }

	 });


	
	</script>



<script type="text/x-red" data-template-name="wechat out"> 


<div class="form-row"> 
<label for="node-input-name">
<i class="icon-tag"></i> name
</label> 
	<input type="text" id="node-input-name" placeholder="Name">
	</div> 



	</script>


<script type="text/x-red" data-help-name="wechat out">
 <p>ETI wechat makes a difference !
 </p> 

 </script>





